<?php
$product_name = $product_type = $country_id = $price = $laboratory = $product_description = "";
?>
<script src='jquery.js' type="text/javascript"></script>
<script src='documentation.js' type="text/javascript"></script>
<script src='jquery.MultiFile.js' type="text/javascript" language="javascript"></script>
<script type="text/javascript" src="<?php echo W_ROOT;?>/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="<?php echo W_ROOT;?>/jscripts/initialeditor.js"></script>
<script type="text/javascript" src="<?php echo W_ROOT;?>/templates/javascripts/jquery.foundation.tabs.js"></script>
<script type="text/javascript" src="<?php echo W_ROOT;?>/templates/javascripts/foundation.min.js"></script>
<script type="text/javascript" src="<?php echo W_ROOT;?>/templates/javascripts/app.js"></script>

<style type="text/css">
table {
    background: none repeat scroll 0 0 #FFFFFF;
    border: 0 solid #DDDDDD;
    border-radius: 3px 3px 3px 3px;
    margin: 0 -75px 18px;
}
table tbody tr td {
    border: medium none;
    color: #333333;
    padding: 9px 1px;
    vertical-align: top;
}
#backgroundPopup{  
            display:none;  
            position:fixed;  
            _position:absolute; /* hack for internet explorer 6*/  
            height:100%;  
            width:100%;  
            top:0;  
            left:0;  
            background:#000000;  
            border:1px solid #cecece;  
            z-index:1;  
}  
#popuptext{  
            display:none;  
            position:fixed;  
            _position:absolute; /* hack for internet explorer 6*/  
            height:400px;  
            width:650px;  
            background:#FFFFFF;  
            border:2px solid #cecece;  
            z-index:2;  
            padding:12px;  
            font-size:13px;  
} 
#popupCategory{  
            display:none;  
            position:fixed;  
            _position:absolute; /* hack for internet explorer 6*/  
            height:400px;  
            width:635px;  
            background:#FFFFFF;  
            border:2px solid #cecece;  
            z-index:2;  
            padding:12px; 
            overflow:scroll;
            overflow-x: hidden; 
} 
#popuptextClose{
            font-size:14px;
            line-height:14px;
            right:6px;
            top:4px;
            position:absolute;
            color:#6fa5fd;
            font-weight:700;
            display:block;
            cursor:pointer;
}
#popupcateClose{
            font-size:14px;
            line-height:14px;
            right:6px;
            top:4px;
            position:absolute;
            color:#6fa5fd;
            font-weight:700;
            display:block;
            cursor:pointer;
}
.check_bok
{
			padding:2px;
			margin:3px;
			cursor:pointer;
			color:#ffffff;
			float: left;
}
.ch_red
{
   background: red;
}
</style>

<script language="javascript">  
    function fncCreateElement(){
      
    var mySpan = document.getElementById('mySpan');  
      
    var myLine = document.getElementById('hdnLine');  
    myLine.value++;  
      
    var myElement1 = document.createElement('input');  
    myElement1.setAttribute('type',"text");  
    myElement1.setAttribute('name',"txtsizename[]");  
    myElement1.setAttribute('style',"width:40px; float: left;margin-right:3px;height: 23px"); 
    myElement1.setAttribute('id',"txt"+myLine.value);  
    mySpan.appendChild(myElement1);  
      
    // Create <br>  
    var myElement2 = document.createElement('<br>');  
    myElement2.setAttribute('id',"br"+myLine.value);  
    mySpan.appendChild(myElement2);  
      
    }  
      
    function fncDeleteElement(){  
      
    var mySpan = document.getElementById('mySpan');  
      
    var myLine = document.getElementById('hdnLine');  
      
    if(myLine.value > 1 )  
    {  
      
    // Remove Text  
    var deleteEle = document.getElementById("txt"+myLine.value);  
    mySpan.removeChild(deleteEle);  
      
    // Remove <br>  
    var deleteBr = document.getElementById("br"+myLine.value);  
    mySpan.removeChild(deleteBr);  
      
    myLine.value--;  
    }  
    }  
    </script>
	<script src="popup.js" type="text/javascript"></script>
	<dl class="tabs">
        <dd class="active"><a href="#simple1">Product</a></dd>
        <dd><a href="#simple2">Chose Categories</a></dd>
 	</dl>
    <ul class="tabs-content">
       <li class="active" id="simple1Tab">
      
          <div class="row">
          			<div class="ten column">
                                <div class="twelve column">
                                	<div class="row">
                                    <div class="two column">Product Name :</div>
                                	<div class="ten column"><input type="text"  style="width:435px; top:30px;" name="new_proname" value="<?php echo stripslashes($product_name);?>" /></div>
                                    </div>
                                </div>
                                <!--star code select for color-->
                                 <?php 
                                 $str_color=mysql_query("SELECT * FROM tbl_color");
         						 ?>
                                 <!--end code select for color-->
                                 <div>&nbsp;</div>
                                 
                                 <div class="twelve column">
                                 	<div class="row">
                                    	<div class="two column">
                                        Color :
                                        </div>
                                        <div class="ten column">
                                	    <?php while($rows_color=mysql_fetch_array($str_color)){ ?>
       <div class="check_bok" style="background-color:<?php echo $rows_color['color_name']?>"> <input type="checkbox" name="txtcheckboxProduct[]" value="<?php echo $rows_color['color_id']?>"></div>      
     <?php }   ?>					    </div>
                                    </div>
                                </div>
                                
                                <div>&nbsp;</div>
                                
                                <div class="twelve column">
                                	<div class="row">
                                    	<div class="two column">
                                		Size :
                                		</div>
                                		<div class="ten column">
                                			<div id="mySpan" style="float:left;"><input type="text" name="txtsizename[]" style="width:40px; float: left;margin-right:3px;height: 23px"></div>  
           <input id="hdnLine" name="hdnLine" type="hidden" value="1"> 
           <input class="btn" type="button" value="+" onClick="JavaScript:fncCreateElement();" id="adin">
           <input class="btn" type="button" name="btnDelete" value="-" onClick="JavaScript:fncDeleteElement();" id="adin">
                                       		</div>
                                    	</div>   
                             	 </div>
                                 
                                 <div>&nbsp;</div>
                                    	<div class="twelve column">
                                        	<div class="three column">
                                             Brand name : <br/><?php
											   $b_get = mysql_query("SELECT * FROM tbl_brand"); 
											 ?>
												<select name="selectType" id="selectbox" style="width:180px;">
												<option>Select Brand</option>
												<?php
												 while ($brand = mysql_fetch_assoc($b_get))
												 {
												?>    
												<option value="<?php echo $brand['brand_name'];?>"><?php echo $brand['brand_name'];?></option>
												<?php
												 }
												 ?>
												</select>
                                            </div>
                                            
                                            
                                            <div class="three column">
                                            Made In : <br/><select name="selectCoun[]" id="selectbox" style="width:180px;" class="selectCon">
    <option value="">Select Country</option>
    <?php
	$sql_coun = "SELECT id,country_name FROM tblcountries";

	$result_coun = mysql_query($sql_coun);
	while($row_coun = mysql_fetch_assoc($result_coun)){
	?>
    <option value="<?php echo $row_coun['id']?>"><?php echo $row_coun['country_name']?></option>
    <?php	
	}
	?>
   
    												</select>
                                            </div>
                                            
                                             <div class="three column">
                                             Price($) : <br/><input type="text" name="price_regular[]" style="width:130px;"                         value="" class="txtprice" />
                                             </div>
                                            
                                            <div class="three column">
                                             Regular Price($) : <br/><input type="text" name="price_regular[]" style="width:130px;"value="" class="txtprice" />
                                            </div>
                                
                                
                                
                	            <div class="twelve column">Short Description : 
                   				 <textarea name="shot_disc" id="shot_disc" rows="20" style="height:200px;"><?php //echo stripslashes(short_desciption);?></textarea>
                                 </div>
                                 <div class="twelve column"> &nbsp;</div>
                                 <div  class="twelve column">Long description : 
                              	 <textarea name="txtdesc" id="txtdesc" rows="20" style="height:200px;"><?php echo stripslashes($product_description);?></textarea>
                                 </div>
                                 
                                <div>&nbsp;</div>
                                <div class="twelve column">
                                    <img src="<?php echo W_ROOT;?>/images/add_icon.jpg" border="0" /> 
            <a style="color:#00F; text-decoration:underline" href="#" id="clicktoadd" onclick="addCountry($(this)); return false;">
            						<em>Add another Country</em></a>
                                    
            				    <div>&nbsp;</div>
                               
                               </div>
                               
                               <div class="twelve column">
                               		<div class="row">
                                    	<div class="two column">
                              			 Image :
                                		</div>
                                        <div class="ten column">
                                		
                                	<input type="file" class="multi" name="imagefile[]" size="56"/><br />
                                    	</div>
           <em style="color:#666;">You can add more than one time</em>
           
           							</div>
                               </div>
                  <?php
                    $sql_img = "SELECT * FROM tblimage WHERE product_id =".$id;
                    $result_img = mysql_query($sql_img);
                    if(dbNumRows($result_img)){
                    ?>
                    <div class="imageitem">
                             <div style="width:154px; height:30px; text-align:left;"></div>
                             <div style="width:66px; vertical-align:top;"></div>
                             <div style="width:942px; padding-bottom:10px;"></div>
       				<?php
                    while( $row_img = mysql_fetch_assoc($result_img)){
                        if($row_img['product_id'] !=""){
                   ?>
                   <div style="float:left;" class="div<?php echo $row_img['id'];?>">
                   <img src="images/<?php echo $row_img['thumbnail'];?>" class="border" />
                   </div>
                   <?php
                        }//end if
                        }//end if
                        }//end while
                   ?>
				  
			</div>
            </div>
			
    </div>
     
      <!-- test-->
    </li>
    <li id="simple2Tab">
    <div class="row">
    	<div class="twleve column">
           <?php
	      //include('category.php');
	       ?> 
        </div>
    </div>
 </li>
</ul>
<!--end foundation-->
<input class="btn btn-primary" type="button" name="btnsubmit" value="Save" onclick="checkSellerform();" /> &nbsp;&nbsp;&nbsp;
                    <input class="btn btn-warning" type="button" value="Cancel" onclick="window.location.href='index.php'" />
                    <input type="hidden" name="hidid" value="<?php echo $id;?>" />
<script type="text/javascript">
	var addCountryHtml = "<tr>" + $("#tblAddPro tr:eq(3)").html() + "</tr><tr>" + $("#tblAddPro tr:eq(4)").html() + "</tr>";
	function addCountry(aLink){
		aLink.parent().parent().before(addCountryHtml);
		$('.txtprice:last').val('');
		$('.labor:last').val('');
		$('.selectCon:last').val('');
	}       
</script>
<div id="backgroundPopup"></div> 